﻿<UserControl x:Class="Knihotoc_WP8.CustomControls.LoggedInUserData"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:customControls="clr-namespace:Knihotoc_WP8.CustomControls"
    xmlns:settings="clr-namespace:Knihotoc_WP8.Settings"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">

    <UserControl.Resources>
        <DataTemplate x:Key="bookItemTemplate">
            <customControls:GridID Tap="BookItemTemplate_Tap" ID="{Binding ID}">
                <customControls:GridID.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="*" />
                </customControls:GridID.ColumnDefinitions>
                <Image Grid.Row="0"
                       Grid.Column="0"
                       Height="70"
                       Width="50" 
                       Source="{Binding CoverImagePath}" 
                       Visibility="{Binding ImageThumbnailVisibility}"/>
                <TextBlock Grid.Row="0" 
                               Grid.Column="1"
                               TextWrapping="NoWrap"
                               FontSize="40"
                               Text="{Binding Title}" />
            </customControls:GridID>
        </DataTemplate>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="{Binding Source={StaticResource CurrentSettings}, Path=BackgroundColor, Mode=TwoWay}">
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="32"/>
            <RowDefinition Height="32"/>
            <RowDefinition Height="24"/>
            <RowDefinition Height="16" />
            <RowDefinition Height="44*" />
            <RowDefinition Height="220*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="0.475*" />
            <ColumnDefinition Width="0.525*"/>
        </Grid.ColumnDefinitions>

        <Image x:Name="userImage"
               Grid.Row="0"
               Grid.Column="0"
               Width="160" Margin="0,0,0,5" d:LayoutOverrides="VerticalAlignment" Grid.RowSpan="4" CacheMode="BitmapCache" Source="/Knihotoc_WP8;component/Images/unknown_user_1.png"
               
               />

        <TextBlock x:Name="usernameText"
                   Grid.Row="0"
                   Grid.Column="1"
                   TextAlignment="Left" Grid.RowSpan="1" Text="Bart Simpson" Margin="13,0,0,0" FontSize="26.667" Grid.ColumnSpan="2" />

        <TextBlock x:Name="currentlyReadingLabel"
                   Grid.Row="5" Grid.ColumnSpan="3"
                   Text="{Binding ConverterParameter=CurrentlyReadingLabel, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}"
                   Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"
                   TextAlignment="Left" FontSize="24" Margin="0,0,0,7" />

        <ListBox x:Name="currentlyReadingListBox"
                 Grid.Row="6" Grid.ColumnSpan="3"
                 ItemTemplate="{StaticResource bookItemTemplate}" FontSize="26.667" Grid.RowSpan="1" />

        <Button x:Name="allMyBooksButton"
                Grid.Row="7" Grid.ColumnSpan="3"
                Click="AllMyBooksButton_Click"                
                Content="{Binding ConverterParameter=AllMyBooksButton, Converter={StaticResource LocalizedStrings}, Source={StaticResource LocalizedStrings}}"
                BorderBrush="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}"
                Foreground="{Binding Source={StaticResource CurrentSettings}, Path=ForegroundColor, Mode=TwoWay}" />
        <TextBlock Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Text="Found" Height="32" VerticalAlignment="Bottom" Margin="27,0,0,0"/>
        <TextBlock Grid.Column="1" Grid.Row="2" TextWrapping="Wrap" Text="Borrowed" Height="32" VerticalAlignment="Bottom" Margin="27,0,0,0"/>
        <TextBlock x:Name="foundBooksField" Grid.Column="2" Grid.Row="1" TextWrapping="Wrap" Text="121"/>
        <TextBlock x:Name="borrowedBooksField" Grid.Column="2" Grid.Row="2" TextWrapping="Wrap" Text="5"/>
    </Grid>
</UserControl>